<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title> </title>
</head>
<body>
        <script>
            var a = 10;
            function foo() {
                var b = 20;
                console.log('我是函数')
            }
            console.log(window.a);
            console.log(window.foo);
            console.log(window.b);      //  undefined;  b不是第一层级定义的变量，所以无法读取
        </script>
</body>
</html>